<template>
  <el-pagination
    class="yao"
    :background="true"
    v-model:current-page="currentPage4"
    v-model:page-size="pageSize4"
    :layout=" istrue?' prev, pager, next,total, sizes' :' prev, pager, next'"
    :page-sizes="[5,10,15,20,50,100]"
    :total="totalSize"
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
  />
</template>

<script setup>
import { ref ,onMounted, watchEffect, computed,getCurrentInstance} from "vue";
// import {staffData } from "@/stores/staff.js"
let {proxy} = getCurrentInstance()
// console.log(proxy.$Bus,"fesfes")
// let mStaff = staffData()

let pageSize4 = ref(10);

let props = defineProps({
  pageTotalSize:{
    tyle:Number,
    default:0
  }
})


let currentPage4 = ref(1);
let wid = ref(0)

let totalSize = computed(()=>{
  // console.log(mStaff.count)
    return props.pageTotalSize

})


const handleSizeChange = (val) => {
  // console.log(`${val} items per page`);
    // mStaff.take = val
    currentPage4.value = 1
  proxy.$Bus.emit("changeSizePage",val)

};
const handleCurrentChange = (val) => {
  // console.log(`${val} current num`);
  // mStaff.current = val
  proxy.$Bus.emit("changeCurrentPage",val)
}

let istrue = computed(()=>{
  return wid.value<=1290?false:true
})

watchEffect(()=>{
  wid.value = 100
})

// 获取屏幕的宽度

let  getGreenwithed = ()=>{
  let w = document.documentElement.clientWidth
  // console.log(w)
  // mStaff.wid = w
}

onMounted(()=>{
  window.onresize = ()=>{
     getGreenwithed()
  }
})
</script>

<style lang="scss" scoped>
</style>